#!/bin/bash

for i in $( ls *.txt );
do
  txtfile=$i
  gtfile=$( echo $i | sed -e "s/txt/gt/" )
  pngfile=$( echo $i | sed -e "s/txt/png/" )
  ./measure ./$txtfile ./$gtfile
  echo "set terminal png" > a.pl
  echo "set output '"$pngfile"'" >> a.pl
  echo "plot '"$txtfile"', '"$gtfile"' with lines" >> a.pl
  gnuplot a.pl
done

